/* ======================================================================
 * @description header/footer js文件
 * @author Raiyen
 * @time 20160329
 * ======================================================================
 */
//加载header
function getHeaderHtml(){
	$.ajax({
			type: "get",
			url: "header.html",
			success: function(data) {
				$('#header').html(data);
			}
	});
	//下拉菜单
	$("#header").on("mouseenter",".nav .pull-btn",function(){
		var pullBtn = $("#header").find(".nav .pull-btn");
    	var pullNav = $("#header").find(".pull-nav");
    	var pullCon = $("#header").find(".pull-nav .pull-con");
	    var index = pullBtn.index(this);
        pullNav.slideDown();
        pullBtn.find('a').removeClass('active').end().eq(index).find('a').addClass('active');
        pullCon.hide().eq(index).show();
	       
	});
	$("#header").on("mouseleave",".nav .pull-btn",function(e){
		var pullBtn = $("#header").find(".nav .pull-btn");
    	var pullNav = $("#header").find(".pull-nav");
    	var pullCon = $("#header").find(".pull-nav .pull-con");
		var target = $(e.relatedTarget);
        if (!pullNav.has(target).length && !target.hasClass('pull-nav') && 
                !target.parents('.pull-btn').length && !target.hasClass('pull-btn') ) {
            pullNav.stop().slideUp();
            pullBtn.find('a').removeClass('active');
        }
	});
	$("#header").on("mouseleave",".pull-nav",function(e){
		var pullBtn = $("#header").find(".nav .pull-btn");
   	 	var pullNav = $("#header").find(".pull-nav");
    	var pullCon = $("#header").find(".pull-nav .pull-con");
		var target = $(e.relatedTarget);
        if (!pullNav.has(target).length && !target.hasClass('pull-nav') && 
                !target.parents('.pull-btn').length && !target.hasClass('pull-btn') ) {
            pullNav.stop().slideUp();
            pullBtn.find('a').removeClass('active');
        }
	});
}
//加载footer
function getFooterHtml(){
	$.ajax({
			type: "get",
			url: "footer.html",
			success: function(data) {
				$('#footer').html(data);
			}
	});
}